package com.winsomely.leecode;

import java.util.ArrayList;
import java.util.List;

/**
 * Fizz Buzz
 * 
 * @author liujiawei
 *
 */
public class FizzBuzz {

	public List<String> fizzBuzz(int n) {
		List<String> list = new ArrayList<>(n);
		String s3 = "Fizz", s5 = "Buzz", s35 = "FizzBuzz";
		for (int i = 0; i < n; i++) {
			if ((i + 1) % 15 == 0) {
				list.add(s35);
			} else if ((i + 1) % 3 == 0) {
				list.add(s3);
			} else if ((i + 1) % 5 == 0) {
				list.add(s5);
			} else {
				list.add(String.valueOf(i + 1));
			}
		}
		return list;
	}

	public static void main(String[] args) {
		FizzBuzz t = new FizzBuzz();
		int n = 15;
		List<String> list = t.fizzBuzz(n);
		for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}

	}

}
